<?php
    apf_require_class("PageHelper");
    $img_path = '/img/home/';
    ?>

<div class="header">
    <div class="bg_top"></div>
    <div class="logo"></div>
</div>
<div class="container">
<h1>招聘需求审批</h1>
<table>
    <tr>
        <td><label>姓名：</label><?=$user['real_name']?>-<?=$user['user_code']?></td>
        <td><label>职位：</label><?=$user['position_name']?></td>
        <td><label>部门：</label><?=$user['bu_name']?><?=$user['department_name']?></td>
        <td><label>申请时间：</label><?=$recruit['created']?></td>
    </tr>
</table>
<form id="form1" action="" method="post">
    <ul>
        <li>
            <p>
                <label>部门：</label><?=$recruit['bu_name']?><?=$recruit['department_name']?>
            </p>

            <p>
                <label>职位名称：</label><?=$recruit['position_name']?>（计划编制：<?=$recruit['old_plan_num']?> 人  &nbsp;&nbsp; &nbsp; 在编：<?=$recruit['old_fact_num']?>人）
            </p>

            <p>
                <label>需求人数：</label><?=$recruit['job_needs']?>人（编制内：<?=$recruit['plan_num']?>人 &nbsp;&nbsp; &nbsp; 编制外：<?=$recruit['out_plan_num']?>人）
            </p>

            <p>
                <label>员工类型：</label><?=$recruit['type_name']?>
            </p>

            <p>
                <label>职级范围：</label><?=$recruit['p_m_start']?>－<?=$recruit['p_m_end']?>
            </p>

            <p>
                <label>申请原因：</label><span class="multiline"><?=nl2br(htmlspecialchars($recruit['apply_reason']))?></span>
            </p>

            <p>
                <label>工作地点：</label><?=$recruit['address_name']?>
            </p>
            <h2>申请信息</h2>
            <hr/>

        </li>

        <li>
            <p>
                <label>通用能力：</label><?=$recruit['work_core']?>
            </p>

            <p>
                <label>专业能力：</label><span class="multiline"><?=nl2br(htmlspecialchars($recruit['work_special']))?></span>
            </p>
            <h2>能力要求</h2>
            <hr/>
        </li>

        <li>
            <p>
                <label>工作职责：</label><span class="multiline"><?=nl2br(htmlspecialchars($recruit['work_plus']))?></span>
            </p>

            <p>
                <label>岗位要求：</label><span class="multiline"><?=nl2br(htmlspecialchars($recruit['work_skilled']))?></span>
            </p>
            <h2>岗位描述</h2>
         <hr/>
        </li>

        <li>
            <p>
                <label>笔试：</label><?php if($recruit['is_written']==1){?>需要<?php }else{?>不需要<?php }?>
            </p>
            <?php if($recruit['is_written']==1){?>
            <p>
                <label>试卷编号：</label><?=htmlspecialchars($recruit['written_info'])?>
            </p>
            <?php }?>
            <h2>考核要求</h2>
        </li>
        <!-- start $flow['recruit']-->
        <?php foreach ($all_flows as $now_stage=>$one_flow){?>
        <?php if(!$flow['recruit'] && $now_stage >3 && $now_stage<14){continue;}?>
        <?php if($recruit[$one_flow['name'].'_apply'] && !in_array($one_flow['phase'], $allow_opts) && ($flow['recruit'] || in_array($now_stage, $plan_in))){?>
        <li style="margin-top: 35px;">
            <h2><?=$one_flow['title']?>审批</h2>
            <p style="margin: 0px;padding:0px;">
                <span style="padding-left: 250px;"><?=$operate_log[$one_flow['phase']]['opt_user_name']?>已<?php if($recruit[$one_flow['name'].'_apply']==1){?>批准<?php }else{?>驳回<?php }?>了该申请</span>
                <span style="padding-left: 20px;"><?=$operate_log[$one_flow['phase']]['operate_time']?></span>
                <?php if($recruit[$one_flow['name'].'_apply']==2){?>
                <p style="padding-left: 250px;"><?=$recruit[$one_flow['name'].'_reason']?></p>
                <?php }?>
            <hr/>
        </li>
        <?php }elseif(!in_array($one_flow['stage'],$ceo_operate_hide)){?>
        <li style="margin-top: 35px;">
            <?php if($flow['now_status']==Const_Flow::FLOW_STATUS_CANCEL_SYSTEM && !$recruit[$all_flows[$one_flow['next_stage']]['name'].'_apply']){?>
            <?php if($flow['flow_stage']==$all_flows[$one_flow['pre_stage']]['stage']){?>
            <h2><?=$one_flow['title']?>审批</h2>
            <p style="margin: 0px;padding:0px;">
                <p style="padding-left: 250px;">该<?=$one_flow['title']?>超时未处理，系统已自动撤销</p>
            <hr/>
            <?php }?>
            <?php }else{?>
            <h2><?=$one_flow['title']?>审批</h2>
            <hr style="padding-top: 20px;"/>
            <?php if($one_flow['name']=='hr' && !empty($lums_dep)){?>
            <p style="padding: 0">
            <label>Lumesse职位：</label>
            <input <?php if(isset($error['hr_lumesse'])){echo 'class="bcolor"';}?>  type="text" style="width: 200px;" disabled="disabled" name="hr_lumesse" value="<?=$recruit['hr_lumesse']?>"/>
            </p>
            <p style="padding: 0">
            <label>Lumesse部门：</label>
            <select name="lums_dep_id" disabled="disabled">
            <?php foreach ($lums_dep as $val):?>
            <option value="<?=$val['lums_depart_id']?>"  ><?=$val['pre'].$val['lums_depart_name']?></option>
            <?php endforeach;?>
            </select>

            </p>
            <?php }else{?>
            <?php if($one_flow['stage']==Const_Flow::FLOW_RECRUIT_14 && empty($lums_dep) && !empty($userinfo['role_list'][Const_Flow::ROLE_RECRUIT])):?>
            <p style="padding: 0">
            <label>Lumesse职位：</label>
            <font color="red">申请人在Lumesse系统中没有找到对应的账号或部门信息,请绑定账号后,再操作</font>
            </p>
            <?php endif;?>

            <?php }?>
            <p style="padding: 0">
                <label></label><input type="radio" disabled="disabled" name="<?=$one_flow['name']?>_apply" value="1" <?php if($recruit[$one_flow['name'].'_apply']!=2) echo 'checked';?>/>批准该申请
            </p>

            <p>
                <label></label><input type="radio" disabled="disabled" name="<?=$one_flow['name']?>_apply" value="2" <?php if($recruit[$one_flow['name'].'_apply']==2 || isset($error[$one_flow['name'].'_reason'])) echo 'checked';?>/>驳回该申请
            </p>
            <p>
               <span style="padding-left: 275px;">原因：<textarea <?php if(isset($error[$one_flow['name'].'_reason'])){echo 'class="bcolor"';}?> style="vertical-align: top" cols="50" rows="5" disabled="disabled" name="<?=$one_flow['name']?>_reason"><?=$recruit[$one_flow['name'].'_reason']?></textarea></span>
            </p>
            <?php }?>
        </li>
        <?php }?>
        <?php }?>
        <!-- end -->
    </ul>
<?php /*如果是招聘角色进来,没有lumesse部门信息，就不能提交*/?>
    <?php if($allow_names){?>
    <input type="submit" class="submit" value="" <?php if(!empty($userinfo['role_list'][Const_Flow::ROLE_RECRUIT]) && empty($lums_dep)):?> style="display:none;"<?php endif; ?>/>
    <?php }?>
    <?php if(empty($recruit['lums_position_id']) && $recruit['apply_status']==2 && !empty($userinfo['role_list'][Const_Flow::ROLE_RECRUIT])):?>
    <li style="margin-top: 35px;">
    <h2>&nbsp;</h2>
    <p><label></label>
    <select name="lums_dep_id2" id="lums_dep_id2"  >
            <?php foreach ($lums_dep as $val):?>
            <option value="<?=$val['lums_depart_id']?>" <?php if($val['lums_depart_id']==$recruit['lums_depart_id']):?>selected="selected"<?php endif;?> ><?=$val['pre'].$val['lums_depart_name']?></option>
            <?php endforeach;?>
            </select>
    <a href="<?=Flow_Urls::flow_recruitment($recruit['flow_id'])?>&sync=1" id="sync_url" onclick="var sv=$('#lums_dep_id2').val();var url =$('#sync_url').attr('href');url+='&sync_lums_dep_id='+sv;$('#sync_url').attr('href',url);">同步职位信息</a>
    </p>
    </li>
    <?php endif;?>

</form>
</div>
<div class="footer">
</div>
    <?php $this->script_block_begin(); ?>
<script type="text/javascript">
//用JS打开允许操作的input
function open_allow_names(){
    var allow_names = <?=json_encode($allow_names)?>;
    $(allow_names).each(function(index,value){
        $("[name='"+value+"']").attr("disabled",false);
    });
}
open_allow_names();
</script>
    <?php $this->script_block_end(); ?>